import Vue from 'vue'
import ViewUI from 'view-design';
import App from './App.vue'
import VueRouter from 'vue-router';
import routers from './router';
import Util from './libs/util';
import store from './store'

import 'view-design/dist/styles/iview.css';
import './my-theme/index.less';
import './styles/common.css'

Vue.use(VueRouter);
Vue.use(ViewUI);

// 路由配置
const RouterConfig = {
  mode: 'history',
  routes: routers
};
const router = new VueRouter(RouterConfig);

router.beforeEach((to, from, next) => {
    // console.log(to, from, next)
    ViewUI.LoadingBar.start();
    Util.title(to.meta.title);
    next();
});

router.afterEach((to, from, next) => {
  // console.log(to, from, next)
  ViewUI.LoadingBar.finish();
  window.scrollTo(0, 0);
});

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
